//FYI: https://github.com/Tencent/puerts/blob/master/doc/unity/manual.md

import { FairyEditor, System } from 'csharp';

const Directory = System.IO.Directory;

function onPublish(handler: FairyEditor.PublishHandler) {
    let codePkgName = handler.ToFilename(handler.pkg.name); //convert chinese to pinyin, remove special chars etc.
    let exportPath = handler.exportPath + '\\' + codePkgName;

    if (!Directory.Exists(exportPath)) {
        Directory.CreateDirectory(exportPath);
    }

    handler.exportPath = exportPath;
}

function onDestroy() {
    //do cleanup here
}

export { onPublish, onDestroy };
